<?php
	
//var_dump($_POST);
$content = $_POST['content'];
$username = $_POST['username'];
//var_dump($content);
//var_dump($username);
if(trim($content)=='' or trim($username)==''){
    echo '用户名，留言内容不能为空';
    exit;
}
if($username=='admin' || $username=='root' || $username=='领导人'){
    echo '用户名不能为敏感字';
    exit;
}

echo '<br/>';

    //$dsn = 'mysql:dbname=php10-7;host=127.0.0.1';
    //$pdo = new PDO($dsn,'root','');
    include('db.php');

    $sql = "insert into `msg` (`username`,`content`) values ('{$username}','{$content}')";
    write($pdo,$sql);

    
    //header('location: index.php');
    header('location: bootstrap.php');
?>

